package com.gocoolmall.config;

import com.gocoolmall.order.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器的配置
 */
@Configuration
public class GocoolMallWebConfig implements WebMvcConfigurer {
//    //视图映射
//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
//
////        registry.addViewController("/login.html").setViewName("login");
//        //只是get请求能映射
////        registry.addViewController("/reg.html").setViewName("reg");
//    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
